#include <iostream>
#include <vector>
#include "Thread.hpp"

void test()
{
    int cnt=5;
    while(cnt--)
    {
        std::cout<<"线程运行了"<<std::endl;
        sleep(1);
    }
}

int main()
{
    std::vector<Thread> threads;
    for(int i=0;i<5;i++)
    {
        std::string name="thread-";
        name+=std::to_string(i);
        Thread t(test,name);
        threads.push_back(t);
    }

    for(auto&e:threads)
    {
        e.start();
    }

    for(auto&e:threads)
    {
        e.join();
    }
}